package com.zx.cloud.controller.client;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.zx.cloud.Shift;
import com.zx.cloud.controller.StatusCode;
import com.zx.cloud.model.response.ObjectDataResponse;

/**
 * @author Alex
 */
@Component
public class ProviderClientFallback implements ProviderClient {
	
    private static final Logger LOGGER = LoggerFactory.getLogger(ProviderClientFallback.class);

    private void didNotGetResponse() {
        LOGGER.error("service '{}' has become unreachable", ProviderClient.SERVICE_ID);
    }

	@Override
	public ObjectDataResponse<Integer> buildOverdue() {
		 didNotGetResponse();
	        Shift.fatal(StatusCode.SERVER_IS_BUSY_NOW);
		return null;
	}

	@Override
	public ObjectDataResponse<Integer> withhold() {
		didNotGetResponse();
        Shift.fatal(StatusCode.SERVER_IS_BUSY_NOW);
		return null;
	}

}
